﻿#include "MotionController.h"
MotionController::MotionController(QObject *parent)
    :QObject(parent)
{
    //m_INPortStatus = 0;
}

int MotionController::errCode()
{
    return m_errno;
}

bool MotionController::axisCount(int &count)
{
    m_errno = MTCTR_UNKNOWN;
    count = 0;
    return false;
}

bool MotionController::setSpeed2(unsigned short axis, int start_speed, int max_speed, double tacc, double tdec, int stop_speed)
{
    Q_UNUSED(start_speed);
    Q_UNUSED(tacc);
    Q_UNUSED(tdec);
    Q_UNUSED(stop_speed);
    return setSpeed(axis, max_speed);
}

bool MotionController::setHomeSpeed2(unsigned short axis, int start_speed, int max_speed, double tacc, double tdec, int stop_speed)
{
    Q_UNUSED(start_speed);
    Q_UNUSED(tacc);
    Q_UNUSED(tdec);
    Q_UNUSED(stop_speed);
    return setHomeSpeed(axis, max_speed);
}

bool MotionController::setStartSpeed(unsigned short axis, int startSpeed)
{
    Q_UNUSED(axis);
    Q_UNUSED(startSpeed);
    return false;
}

bool MotionController::setStopSpeed(unsigned short axis, int stopSpeed)
{
    Q_UNUSED(axis);
    Q_UNUSED(stopSpeed);
    return false;
}

bool MotionController::goHome(unsigned short axis, int speed)
{
    setHomeSpeed(axis, speed);
    return home(axis);
}

bool MotionController::readLimitStatus(unsigned short axis, bool &llimit, bool &rlimit, bool &home)
{
    bool b1 = isReverseLimit(axis, llimit);
    bool b2 = isForwardLimit(axis, rlimit);
    bool b3 = isHome(axis, home);
    return b1 && b2 && b3;
}

bool MotionController::setPWMOut(int channel, double freq, double duty)
{
    Q_UNUSED(channel);
    Q_UNUSED(freq);
    Q_UNUSED(duty);
    return false;
}

bool MotionController::PWMValue(int channel, double &freq, double &duty)
{
    Q_UNUSED(channel);
    Q_UNUSED(freq);
    Q_UNUSED(duty);
    return false;
}
